# Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.

#.rst:
# FindVulkan
# ----------
#
# Try to find Vulkan
#
# IMPORTED Targets
# ^^^^^^^^^^^^^^^^
#
# This module defines :prop_tgt:`IMPORTED` target ``Vulkan::Vulkan``, if
# Vulkan has been found.
#

if(NOT VULKAN_LOADER_INSTALL_DIR)
     set(VULKAN_LOADER_INSTALL_DIR $ENV{VULKAN_SDK})
endif()

#message(STATUS "Vulkan FOUND DIR = ${VULKAN_LOADER_INSTALL_DIR}")
if(WIN32)
find_library(Vulkan_LIBRARY
    NAMES vulkan-1
      PATHS
      "${VULKAN_LOADER_INSTALL_DIR}/lib"
      "${VULKAN_LOADER_INSTALL_DIR}/bin")
 else()
 find_library(Vulkan_LIBRARY
    NAMES vulkan
      PATHS
      "${VULKAN_LOADER_INSTALL_DIR}/lib"
      "${VULKAN_LOADER_INSTALL_DIR}/bin")
 endif()


set(Vulkan_LIBRARIES ${Vulkan_LIBRARY})

#include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Vulkan
  DEFAULT_MSG
  Vulkan_LIBRARY)

#mark_as_advanced(Vulkan_INCLUDE_DIR Vulkan_LIBRARY)

#if(Vulkan_FOUND AND NOT TARGET Vulkan::Vulkan)
#  add_library(Vulkan::Vulkan UNKNOWN IMPORTED)
#  set_target_properties(Vulkan::Vulkan PROPERTIES
#    IMPORTED_LOCATION "${Vulkan_LIBRARIES}"
#    INTERFACE_INCLUDE_DIRECTORIES "${Vulkan_INCLUDE_DIR}")
#endif()
